<ClientManagerView:EventResourceDictionary x:Class="FacebookClient.GlassApplicationBarResourcesDictionary"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:FacebookClient="clr-namespace:FacebookClient"
    xmlns:ClientManager="clr-namespace:ClientManager" 
    xmlns:ClientManagerControls="clr-namespace:ClientManager.Controls" 
    xmlns:ClientManagerView="clr-namespace:ClientManager.View" 
    xmlns:shell="http://schemas.microsoft.com/winfx/2006/xaml/presentation/shell">

  <FacebookClient:NotConverter x:Key="NotConverter" />
  <FacebookClient:IsStringNullOrWhitespaceConverter x:Key="IsStringNullOrWhitespaceConverter"/>

  <Geometry x:Key="DownArrow">M0,0 L1,0 0.5,1Z</Geometry>
  <Geometry x:Key="UpArrow">M0,1 L1,1 0.5,0Z</Geometry>
  <Geometry x:Key="RightArrow">M0,0 L1,0.5 0,1Z</Geometry>
  <Geometry x:Key="LeftArrow">M0,0.5 L1,1 1,0Z</Geometry>
  <Geometry x:Key="HorizontalLine">M0,0 L0,1</Geometry>
  <Geometry x:Key="VerticalLine">M0,0 L1,0</Geometry>
  <Geometry x:Key="LeftRightDiagonalLine">M0,0 L1,1</Geometry>
  <Geometry x:Key="RightLeftDiagonalLine">M1,0 L0,1</Geometry>
  <Geometry x:Key="RightTriangle">M0,0 L0,1 L1,1Z</Geometry>
  <Geometry x:Key="LeftTriangle">M1,0 L1,1 L0,1Z</Geometry>
  <Geometry x:Key="LeftTriangleFlipped">M1,1 L1,0 L0,0Z</Geometry>

  <Style x:Key="OpacityButton" TargetType="{x:Type ButtonBase}">
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="FocusVisualStyle" Value="{x:Null}" />
    <Setter Property="Focusable" Value="False" />
    <Setter Property="Cursor" Value="Hand" />
    <Setter Property="Padding" Value="2" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="HorizontalContentAlignment" Value="Center" />
    <Setter Property="shell:WindowChrome.IsHitTestVisibleInChrome" Value="True" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ButtonBase}">
          <Border x:Name="Border" Background="Transparent">
            <ContentPresenter x:Name="cp" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Opacity="0.5" RecognizesAccessKey="True" />
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="IsPressed" Value="True">
              <Setter TargetName="cp" Property="RenderTransform">
                <Setter.Value>
                  <TranslateTransform Y="1" />
                </Setter.Value>
              </Setter>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard>
                  <Storyboard>
                    <DoubleAnimation Duration="00:00:00.1" Storyboard.TargetName="cp" Storyboard.TargetProperty="Opacity" To="1.0" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <BeginStoryboard>
                  <Storyboard>
                    <DoubleAnimation Duration="00:00:00.2" Storyboard.TargetName="cp" Storyboard.TargetProperty="Opacity" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Trigger.EnterActions>
                <BeginStoryboard>
                  <Storyboard>
                    <DoubleAnimation Duration="00:00:00.1" Storyboard.TargetName="cp" Storyboard.TargetProperty="Opacity" To="0.1" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <BeginStoryboard>
                  <Storyboard>
                    <DoubleAnimation Duration="00:00:00.2" Storyboard.TargetName="cp" Storyboard.TargetProperty="Opacity" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="CaptionButtonStyle" TargetType="{x:Type ButtonBase}">
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="FocusVisualStyle" Value="{x:Null}" />
    <Setter Property="Focusable" Value="False" />
    <Setter Property="Cursor" Value="Arrow" />
    <Setter Property="Padding" Value="2" />
    <Setter Property="Width" Value="32" />
    <Setter Property="Height" Value="19"/>
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="HorizontalContentAlignment" Value="Center" />
    <Setter Property="shell:WindowChrome.IsHitTestVisibleInChrome" Value="True" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ButtonBase}">
          <Border x:Name="Border" BorderBrush="#66000000" BorderThickness="0" CornerRadius="0,0,4,4">
            <Border.Background>
              <LinearGradientBrush StartPoint=".5,0" EndPoint=".5,0">
                <GradientStop Offset="0" Color="Transparent"/>
                <GradientStop Offset=".5" Color="Transparent"/>
                <GradientStop Offset=".5" Color="White"/>
                <GradientStop Offset="1" Color="Transparent"/>
              </LinearGradientBrush>
            </Border.Background>
            <ContentPresenter x:Name="cp" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Opacity="0.5" RecognizesAccessKey="True" />
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="IsPressed" Value="True">
              <Setter TargetName="cp" Property="RenderTransform">
                <Setter.Value>
                  <TranslateTransform Y="1" />
                </Setter.Value>
              </Setter>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard>
                  <Storyboard>
                    <DoubleAnimation Duration="00:00:00.1" Storyboard.TargetName="cp" Storyboard.TargetProperty="Opacity" To="1.0" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <BeginStoryboard>
                  <Storyboard>
                    <DoubleAnimation Duration="00:00:00.2" Storyboard.TargetName="cp" Storyboard.TargetProperty="Opacity" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Trigger.EnterActions>
                <BeginStoryboard>
                  <Storyboard>
                    <DoubleAnimation Duration="00:00:00.1" Storyboard.TargetName="cp" Storyboard.TargetProperty="Opacity" To="0.1" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <BeginStoryboard>
                  <Storyboard>
                    <DoubleAnimation Duration="00:00:00.2" Storyboard.TargetName="cp" Storyboard.TargetProperty="Opacity" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="EditToggle" TargetType="ToggleButton">
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="FocusVisualStyle" Value="{x:Null}" />
    <Setter Property="Focusable" Value="False" />
    <Setter Property="Cursor" Value="Hand" />
    <Setter Property="Padding" Value="0" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="HorizontalContentAlignment" Value="Center" />
    <Setter Property="shell:WindowChrome.IsHitTestVisibleInChrome" Value="True" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ButtonBase}">
          <Grid Background="Transparent">
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*" />
              <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <ContentPresenter x:Name="cp" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Opacity="0.5" RecognizesAccessKey="True" />
            <Path x:Name="EditIcon" Grid.Column="1" Opacity="0" Margin="4,0,0,0" VerticalAlignment="Center" Width="13" Height="13" Data="M3.34,7.70 L1.94,9.10 L1.36,11.58 L3.85,11.01 L5.25,9.61 z M7.01,2.84 L10.15,5.98 L4.13,12.00 L0,12.95 L0.99,8.86 z M9.95,0 C10.07,0 10.18,0.04 10.27,0.13 L12.82,2.67 C12.99,2.85 12.99,3.13 12.82,3.31 L12.40,3.72 L10.75,5.38 L7.57,2.20 L9.22,0.54 L9.64,0.13 C9.72,0.04 9.84,0 9.95,0 z" Fill="#FFFFFF" Stretch="Fill" />
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard>
                  <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="EditIcon" Storyboard.TargetProperty="Opacity" To="1.0" Duration="00:00:00.1" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <BeginStoryboard>
                  <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="EditIcon" Storyboard.TargetProperty="Opacity" Duration="00:00:00.2" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="InvisibleTextBox" TargetType="TextBox">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="FocusVisualStyle" Value="{x:Null}" />
    <Setter Property="OverridesDefaultStyle" Value="True" />
    <Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
    <Setter Property="AllowDrop" Value="true" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type TextBox}">
          <Grid Background="Transparent">
            <TextBlock x:Name="Watermark" Text="{TemplateBinding Tag}" FontStyle="Italic" IsHitTestVisible="False" Opacity="0" />
            <ScrollViewer Margin="0" x:Name="PART_ContentHost" />
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="Opacity" Value="0.5" />
            </Trigger>
            <Trigger Property="Text" Value="">
              <Setter TargetName="Watermark" Property="Opacity" Value="0.5" />
            </Trigger>
            <Trigger Property="IsFocused" Value="True">
              <Setter TargetName="Watermark" Property="Opacity" Value="0" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <SolidColorBrush x:Key="SearchTextBoxBrush" Color="#517dc9" />

  <SolidColorBrush x:Key="StatusTextBoxBrush" Color="#60517dc9" />

  <SolidColorBrush x:Key="HeaderStatusForegroundBrush" Color="White" />

  <SolidColorBrush x:Key="UpdateStatusControlBrush" Color="#DD3b5998" Opacity="0" />

  <LinearGradientBrush x:Key="ButtonHoverBrush" StartPoint=".5,0" EndPoint=".5,1">
    <GradientStop Color="#80698FDD" Offset="0" />
    <GradientStop Color="#35698FDD" Offset="1" />
  </LinearGradientBrush>

  <LinearGradientBrush x:Key="ButtonHoverBorderBrush" StartPoint="0,0" EndPoint="1,1">
    <GradientStop Color="#AF4E6AA2" Offset="0" />
    <GradientStop Color="#804E6AA2" Offset=".5" />
    <GradientStop Color="#004E6AA2" Offset=".55" />
    <GradientStop Color="#35698FDD" Offset="1" />
  </LinearGradientBrush>

  <LinearGradientBrush x:Key="UpdateBoxBorderBackgroundBrush" EndPoint="0.267,1.816" StartPoint="0.799,-0.41">
    <GradientStop Color="#CC0E6DAD" Offset="0" />
    <GradientStop Color="#B20E6DAD" Offset="1" />
    <GradientStop Color="#660E6DAD" Offset="0.34" />
    <GradientStop Color="#66E0E8EE" Offset="0.652" />
  </LinearGradientBrush>

  <ControlTemplate x:Key="ToolbarButtonTemplate" TargetType="{x:Type ButtonBase}">
    <Grid x:Name="Root">
      <Border x:Name="Hover" Background="{DynamicResource ButtonHoverBrush}" BorderBrush="{DynamicResource ButtonHoverBorderBrush}" BorderThickness="1" CornerRadius="3" Opacity="0" />
      <ContentPresenter Margin="4,0" HorizontalAlignment="Center" VerticalAlignment="Center" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="Root" Value="0.4" />
      </Trigger>
      <Trigger Property="IsMouseOver" Value="True">
        <Trigger.EnterActions>
          <BeginStoryboard>
            <Storyboard>
              <DoubleAnimation Duration="0:0:0.3" Storyboard.TargetName="Hover" Storyboard.TargetProperty="Opacity" To=".8" />
            </Storyboard>
          </BeginStoryboard>
        </Trigger.EnterActions>
        <Trigger.ExitActions>
          <BeginStoryboard>
            <Storyboard>
              <DoubleAnimation Duration="0:0:0.3" Storyboard.TargetName="Hover" Storyboard.TargetProperty="Opacity" To="0" />
            </Storyboard>
          </BeginStoryboard>
        </Trigger.ExitActions>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>

  <!-- Just like ToolbarButtonTemplate, but it spins the content a couple times on click. -->
  <ControlTemplate x:Key="SpinningToolbarButtonTemplate" TargetType="{x:Type ButtonBase}">
    <Grid x:Name="Root">
      <Border x:Name="hover" Background="{DynamicResource ButtonHoverBrush}" CornerRadius="3" Opacity="0" />
      <ContentPresenter x:Name="RotatingContentPresenter" RenderTransformOrigin=".5,.5" Margin="4,0" HorizontalAlignment="Center" VerticalAlignment="Center">
        <ContentPresenter.RenderTransform>
          <RotateTransform />
        </ContentPresenter.RenderTransform>
      </ContentPresenter>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="Root" Value="0.4" />
      </Trigger>
      <Trigger Property="IsMouseOver" Value="True">
        <Trigger.EnterActions>
          <BeginStoryboard>
            <Storyboard>
              <DoubleAnimation Duration="0:0:0.3" Storyboard.TargetName="hover" Storyboard.TargetProperty="Opacity" To="1" />
            </Storyboard>
          </BeginStoryboard>
        </Trigger.EnterActions>
        <Trigger.ExitActions>
          <BeginStoryboard>
            <Storyboard>
              <DoubleAnimation Duration="0:0:0.3" Storyboard.TargetName="hover" Storyboard.TargetProperty="Opacity" To="0" />
            </Storyboard>
          </BeginStoryboard>
        </Trigger.ExitActions>
      </Trigger>
      <EventTrigger RoutedEvent="Button.Click">
        <EventTrigger.Actions>
          <BeginStoryboard>
            <Storyboard>
              <DoubleAnimation Storyboard.TargetName="RotatingContentPresenter" Storyboard.TargetProperty="(RenderTransform).(RotateTransform.Angle)" From="0" To="720" Duration="00:00:01.5" />
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger.Actions>
      </EventTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>

  <Style x:Key="BackButtonStyle" TargetType="{x:Type Button}">
    <Setter Property="Width" Value="28" />
    <Setter Property="Height" Value="28" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="FocusVisualStyle" Value="{x:Null}" />
    <Setter Property="Cursor" Value="Hand" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Button}">
          <Grid x:Name="Grid" Background="Transparent">
            <Ellipse x:Name="Ellipse" Fill="White" />
            <Path x:Name="Arrow" Width="8" Height="11" Margin="-1,0,1,0" Data="{DynamicResource LeftArrow}" Fill="{DynamicResource ApplicationBarForeground}" Stretch="Fill" Opacity="0.5" />
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsPressed" Value="True">
              <Setter TargetName="Grid" Property="RenderTransform">
                <Setter.Value>
                  <TranslateTransform Y="1" />
                </Setter.Value>
              </Setter>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard>
                  <Storyboard>
                    <DoubleAnimation Duration="00:00:00.1" Storyboard.TargetName="Arrow" Storyboard.TargetProperty="Opacity" To="1.0" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <BeginStoryboard>
                  <Storyboard>
                    <DoubleAnimation Duration="00:00:00.2" Storyboard.TargetName="Arrow" Storyboard.TargetProperty="Opacity" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Trigger.EnterActions>
                <BeginStoryboard>
                  <Storyboard>
                    <DoubleAnimation Duration="00:00:00.1" Storyboard.TargetName="Ellipse" Storyboard.TargetProperty="Opacity" To="0.25" />
                    <DoubleAnimation Duration="00:00:00.2" Storyboard.TargetName="Arrow" Storyboard.TargetProperty="Opacity" To="1.0" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <BeginStoryboard>
                  <Storyboard>
                    <DoubleAnimation Duration="00:00:00.2" Storyboard.TargetName="Ellipse" Storyboard.TargetProperty="Opacity" />
                    <DoubleAnimation Duration="00:00:00.2" Storyboard.TargetName="Arrow" Storyboard.TargetProperty="Opacity" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="IconButton" TargetType="{x:Type ButtonBase}">
    <Setter Property="FocusVisualStyle" Value="{x:Null}" />
    <Setter Property="SnapsToDevicePixels" Value="true" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="FontFamily" Value="{DynamicResource SansSerifFont}" />
    <Setter Property="FontSize" Value="12" />
    <Setter Property="FontWeight" Value="Bold" />
    <Setter Property="Height" Value="20" />
    <Setter Property="Padding" Value="0" />
    <Setter Property="Cursor" Value="Hand" />
    <Setter Property="Foreground" Value="White" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ButtonBase}">
          <StackPanel x:Name="Root" Background="Transparent" Orientation="Horizontal">
            <Path x:Name="Icon" Margin="{TemplateBinding Padding}" Data="{TemplateBinding Tag}" Fill="#FFFFFF" Stretch="Uniform" Opacity="0.75" VerticalAlignment="Center" />
            <ContentPresenter Margin="8,0" VerticalAlignment="Center" />
          </StackPanel>
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard>
                  <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="Icon" Storyboard.TargetProperty="Opacity" To="1.0" Duration="00:00:00.1" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <BeginStoryboard>
                  <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="Icon" Storyboard.TargetProperty="Opacity" Duration="00:00:00.2" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
              <Setter TargetName="Root" Property="RenderTransform">
                <Setter.Value>
                  <TranslateTransform Y="1" />
                </Setter.Value>
              </Setter>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Setter TargetName="Icon" Property="Opacity" Value="1.0" />
              <Setter Property="Opacity" Value=".25" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="NavigationButtonStyle" TargetType="{x:Type ButtonBase}">
    <Setter Property="FocusVisualStyle" Value="{x:Null}" />
    <Setter Property="SnapsToDevicePixels" Value="true" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="FontFamily" Value="{DynamicResource SansSerifFont}" />
    <Setter Property="FontSize" Value="13" />
    <Setter Property="FontWeight" Value="Bold" />
    <Setter Property="Height" Value="60" />
    <Setter Property="MinWidth" Value="50" />
    <Setter Property="Padding" Value="8,12,8,0" />
    <Setter Property="Cursor" Value="Hand" />
    <Setter Property="shell:WindowChrome.IsHitTestVisibleInChrome" Value="True" />
    <Setter Property="Foreground" Value="White" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ButtonBase}">
          <Grid Background="Transparent">
            <Grid.RowDefinitions>
              <RowDefinition Height="*" />
              <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid x:Name="SelectionBorder" Visibility="Collapsed" Grid.RowSpan="2">
              <Border Margin="1" Background="White" CornerRadius="4,4,0,0">
                <Border.Effect>
                  <DropShadowEffect BlurRadius="7" Direction="-90" Opacity="1.0" ShadowDepth="2" />
                </Border.Effect>
              </Border>
              <Border Background="White" CornerRadius="4,4,0,0" />
            </Grid>

            <Path x:Name="Icon" Margin="{TemplateBinding Padding}" Data="{TemplateBinding Tag}" Fill="#FFFFFF" Stretch="Uniform" VerticalAlignment="Bottom" Opacity="0.5" />
            <ContentPresenter Margin="16,3,16,9" Grid.Row="1" />
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard>
                  <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="Icon" Storyboard.TargetProperty="Opacity" To="1.0" Duration="00:00:00.1" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <BeginStoryboard>
                  <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="Icon" Storyboard.TargetProperty="Opacity" Duration="00:00:00.2" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="NavigationRadioButtonStyle" TargetType="{x:Type RadioButton}">
    <Setter Property="FocusVisualStyle" Value="{x:Null}" />
    <Setter Property="SnapsToDevicePixels" Value="true" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="FontFamily" Value="{DynamicResource SansSerifFont}" />
    <Setter Property="FontSize" Value="13" />
    <Setter Property="FontWeight" Value="Bold" />
    <Setter Property="Height" Value="60" />
    <Setter Property="MinWidth" Value="50" />
    <Setter Property="Padding" Value="8,12,8,0" />
    <Setter Property="Cursor" Value="Hand" />
    <Setter Property="Foreground" Value="White" />
    <Setter Property="shell:WindowChrome.IsHitTestVisibleInChrome" Value="True" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RadioButton}">
          <Grid Background="Transparent" ClipToBounds="True">
            <Grid.RowDefinitions>
              <RowDefinition Height="*" />
              <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid x:Name="SelectionBorder" Visibility="Collapsed" Grid.RowSpan="2" Margin="5,5,5,0">
              <Border Margin="1" Background="White" CornerRadius="4,4,0,0">
                <Border.Effect>
                  <DropShadowEffect BlurRadius="7" Direction="-90" Opacity="1.0" ShadowDepth="2" />
                </Border.Effect>
              </Border>
              <Border Background="White" CornerRadius="4,4,0,0" />
            </Grid>

            <Path x:Name="Icon" Margin="{TemplateBinding Padding}" Data="{TemplateBinding Tag}" Fill="#FFFFFF" Stretch="Uniform" VerticalAlignment="Bottom" Opacity="0.5" />
            <ContentPresenter Margin="16,3,16,9" Grid.Row="1" />
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard>
                  <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="Icon" Storyboard.TargetProperty="Opacity" To="1.0" Duration="00:00:00.1" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <BeginStoryboard>
                  <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="Icon" Storyboard.TargetProperty="Opacity" Duration="00:00:00.2" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="IsChecked" Value="True">
              <Setter TargetName="SelectionBorder" Property="Visibility" Value="Visible" />
              <Setter Property="Foreground" Value="{DynamicResource ApplicationBarForeground}" />
              <Setter TargetName="Icon" Property="Fill" Value="{DynamicResource ApplicationBarForeground}" />
              <Setter TargetName="Icon" Property="Opacity" Value="1.0" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="StatusTextBlockStyle" TargetType="{x:Type TextBlock}">
    <Setter Property="VerticalAlignment" Value="Bottom" />
    <Setter Property="FontSize" Value="{DynamicResource LargeFontSize3}" />
    <Setter Property="FontFamily" Value="{DynamicResource SansSerifFont}" />
    <Setter Property="Foreground" Value="{DynamicResource IconForegroundBrush}" />
    <Setter Property="Margin" Value="0,10,0,0" />
  </Style>

  <Style TargetType="{x:Type FacebookClient:MainHeaderControl}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type FacebookClient:MainHeaderControl}">
          <Border Height="90" BorderBrush="{DynamicResource ApplicationBarBorderBrush}" BorderThickness="1,1,1,0">
            <Border.Style>
              <Style TargetType="{x:Type Border}">
                <Setter Property="Background" Value="{DynamicResource ApplicationBarBackground}" />
                <Setter Property="CornerRadius" Value="6,6,0,0" />
                <Style.Triggers>
                  <DataTrigger Binding="{Binding Path=WindowState, RelativeSource={RelativeSource AncestorType={x:Type FacebookClient:MainWindow}}}" Value="Maximized">
                    <Setter Property="CornerRadius" Value="0" />
                  </DataTrigger>
                  <DataTrigger Binding="{Binding Path=IsActive, RelativeSource={RelativeSource AncestorType={x:Type FacebookClient:MainWindow}}}" Value="False">
                    <Setter Property="Background" Value="{DynamicResource InactiveApplicationBarBackground}" />
                  </DataTrigger>
                  <DataTrigger Binding="{Binding Source={x:Static ClientManager:ServiceProvider.ViewManager}, Path=IsDialogActive}" Value="True">
                    <Setter Property="Background" Value="{DynamicResource InactiveApplicationBarBackground}" />
                  </DataTrigger>
                </Style.Triggers>
              </Style>
            </Border.Style>

            <!-- Split this into two layers so we don't disable the caption buttons based on an active dialog. -->
            <Grid x:Name="Header">
              <Grid>
                <Grid.Style>
                  <Style TargetType="{x:Type Grid}">
                    <Setter Property="IsEnabled" Value="True"/>
                    <Style.Triggers>
                      <DataTrigger Binding="{Binding Source={x:Static ClientManager:ServiceProvider.ViewManager}, Path=IsDialogActive}" Value="True">
                        <Setter Property="IsEnabled" Value="False"/>
                      </DataTrigger>
                      <DataTrigger Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=IsOnline}" Value="False">
                        <Setter Property="IsEnabled" Value="False"/>
                      </DataTrigger>
                    </Style.Triggers>
                  </Style>
                </Grid.Style>

                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="60" />
                  <ColumnDefinition Width="*" />
                  <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <!-- Bottom Shadow -->
                <Border Height="6" VerticalAlignment="Bottom" Grid.ColumnSpan="3" Background="{DynamicResource ApplicationBarShadowBrush}" />

                <!-- Back Button -->
                <Button x:Name="BackButton" Style="{StaticResource BackButtonStyle}" shell:WindowChrome.IsHitTestVisibleInChrome="True" Command="NavigationCommands.BrowseBack" Margin="5,0" ToolTip="Go back" />

                <!-- Name / Status -->
                <Grid Grid.Column="1" VerticalAlignment="Center" Margin="0,0,0,0">
                  <!-- Divider -->
                  <StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
                    <Rectangle Width="1" Fill="#7000" />
                    <Rectangle Width="1" Fill="#3FFF" />
                  </StackPanel>

                  <StackPanel SnapsToDevicePixels="True">
                    <TextBlock Margin="16,0,0,0" FontFamily="{DynamicResource SansSerifFont}" FontSize="21" FontWeight="Bold" Foreground="{DynamicResource HeaderStatusForegroundBrush}" TextTrimming="CharacterEllipsis" >
                      <TextBlock.Style>
                        <Style TargetType="{x:Type TextBlock}">
                          <Setter Property="Text" Value="{Binding Source={x:Static ClientManager:ServiceProvider.ViewManager}, Path=MeContact.Name}" />
                            <Style.Triggers>
                              <DataTrigger Binding="{Binding Source={x:Static ClientManager:ServiceProvider.ViewManager}, Path=MeContact.Name, Converter={StaticResource IsStringNullOrWhitespaceConverter}, FallbackValue=True}" Value="True">
                                <Setter Property="Text" Value="Welcome to Fishbowl" />
                              </DataTrigger>
                            </Style.Triggers>
                          </Style>
                        </TextBlock.Style>
                    </TextBlock>

                    <Grid x:Name="StatusGrid" Margin="16,-1,16,4">
                      <FacebookClient:PopupToggle x:Name="StatusPopupToggle" Style="{StaticResource EditToggle}" Cursor="Hand" Popup="{Binding ElementName=StatusPopup}" Padding="0" shell:WindowChrome.IsHitTestVisibleInChrome="True" IsEnabled="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=IsOnline}" HorizontalAlignment="Left">
                        <TextBlock HorizontalAlignment="Left" FontFamily="{DynamicResource SansSerifFont}" FontSize="14" Foreground="{DynamicResource HeaderStatusForegroundBrush}" TextTrimming="CharacterEllipsis" IsHitTestVisible="False">
                          <TextBlock.ToolTip>
                            <ToolTip Placement="Bottom">
                              <TextBlock TextWrapping="Wrap" MaxWidth="450">
                                <TextBlock.Text>
                                  <MultiBinding StringFormat="{}{0} {1}">
                                    <Binding Source="{x:Static ClientManager:ServiceProvider.ViewManager}" Path="MeContact.Name" />
                                    <Binding Source="{x:Static ClientManager:ServiceProvider.ViewManager}" Path="MeContact.StatusMessage.Message" FallbackValue="" />
                                  </MultiBinding>
                                </TextBlock.Text>
                              </TextBlock>
                            </ToolTip>
                          </TextBlock.ToolTip>
                          
                          <TextBlock.Style>
                            <Style TargetType="{x:Type TextBlock}">
                              <Setter Property="Text" Value="{Binding Source={x:Static ClientManager:ServiceProvider.ViewManager}, Path=MeContact.StatusMessage.Message}" />
                              <Style.Triggers>
                                <DataTrigger Binding="{Binding Source={x:Static ClientManager:ServiceProvider.ViewManager}, Path=MeContact.StatusMessage.Message, Converter={StaticResource IsStringNullOrWhitespaceConverter}, FallbackValue=True}" Value="True">
                                  <Setter Property="Text" Value="What's on your mind?" />
                                  <Setter Property="FontStyle" Value="Italic" />
                                </DataTrigger>
                              </Style.Triggers>
                            </Style>
                          </TextBlock.Style>
                        </TextBlock>
                      </FacebookClient:PopupToggle>
                      <Popup x:Name="StatusPopup" AllowsTransparency="True" Placement="Bottom" VerticalOffset="-15" IsOpen="{Binding ElementName=StatusControl, Path=IsActive}">
                        <Grid>
                          <FacebookClient:UpdateStatusControlModern x:Name="StatusControl" IsEnabled="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=IsOnline}" Width="{Binding ElementName=StatusPopupToggle, Path=ActualWidth}" MinWidth="400" />
                        </Grid>
                      </Popup>
                    </Grid>

                  </StackPanel>
                </Grid>

                <StackPanel x:Name="NavigationPanel" Orientation="Horizontal" Margin="2,3,5,0" HorizontalAlignment="Right" Grid.Column="3" VerticalAlignment="Bottom">
                  <RadioButton x:Name="HomeNavigationButton" Command="{Binding Path=NavigationCommands.NavigateHomeCommand, Source={x:Static ClientManager:ServiceProvider.ViewManager}}" IsChecked="True" Style="{StaticResource NavigationRadioButtonStyle}" ToolTip="See what's new with your friends" Tag="{DynamicResource HomeGeometry}" Content="Home" />
                  <RadioButton x:Name="FriendsNavigationButton" Command="{Binding Path=NavigationCommands.NavigateFriendsCommand, Source={x:Static ClientManager:ServiceProvider.ViewManager}}" Style="{StaticResource NavigationRadioButtonStyle}" ToolTip="Check in on your friends" Tag="{DynamicResource GroupGeometry}" Content="Friends" />
                  <RadioButton x:Name="ProfileNavigationButton" Command="{Binding Path=NavigationCommands.NavigateProfileCommand, Source={x:Static ClientManager:ServiceProvider.ViewManager}}" Style="{StaticResource NavigationRadioButtonStyle}" ToolTip="Check in on yourself" Tag="{DynamicResource PersonGeometry}" Content="Profile" />
                  <RadioButton x:Name="PhotoAlbumsNavigationButton" Command="{Binding Path=NavigationCommands.NavigatePhotoAlbumsCommand, Source={x:Static ClientManager:ServiceProvider.ViewManager}}" Style="{StaticResource NavigationRadioButtonStyle}" ToolTip="See everyone's photos" Tag="{DynamicResource PicturesGeometry}" Content="Photos" />

                  <StackPanel Orientation="Horizontal" SnapsToDevicePixels="True">
                    <Rectangle Width="1" Fill="#7000" />
                    <Rectangle Width="1" Fill="#3FFF" />
                  </StackPanel>

                  <Grid x:Name="SearchGrid">

                    <FacebookClient:PopupToggle x:Name="SearchPopupToggle" Content="Search" Style="{StaticResource NavigationButtonStyle}" Cursor="Hand" Popup="{Binding ElementName=SearchPopup}" Tag="{DynamicResource SearchGeometry}" />

                    <Popup x:Name="SearchPopup" AllowsTransparency="True" Placement="Bottom" VerticalOffset="-15" HorizontalOffset="-220">
                      <Grid SnapsToDevicePixels="True" Margin="10" Width="320">
                        <Grid.Effect>
                          <DropShadowEffect ShadowDepth="2" Direction="-90" BlurRadius="8" Opacity="0.5" />
                        </Grid.Effect>
                        <Grid.RowDefinitions>
                          <RowDefinition Height="Auto" />
                          <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <Path Data="M0,1 L0.5,0 L1,1 Z" Stretch="Fill" Width="23" Height="19" Fill="{DynamicResource ModernPopupTopBrush}" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,0,52,0" />
                        <Border CornerRadius="4" Grid.Row="1" Grid.ColumnSpan="2" Background="{DynamicResource ModernPopupBrush}" />
                        <Border Background="White" Margin="6" Grid.Row="1" CornerRadius="3" Height="23">
                          <FacebookClient:CommandTextBox x:Name="SearchTextBox" Margin="4,3" CommitCommand="{x:Static FacebookClient:MainHeaderControl.SearchCommand}" CommitCommandParameter="{Binding ElementName=SearchTextBox, Path=Text}" IsEnabled="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=IsOnline}" Style="{DynamicResource InvisibleTextBox}" Tag="Search" BannerText="Search" />
                        </Border>
                      </Grid>
                    </Popup>
                  </Grid>

                  <Button Tag="{DynamicResource FacebookLogoGeometry}" Command="{x:Static FacebookClient:MainHeaderControl.GoToFacebookCommand}" Content="Facebook" Style="{StaticResource NavigationButtonStyle}" />
                </StackPanel>
              </Grid>

              <!-- Caption Buttons -->
              <StackPanel HorizontalAlignment="Right" Margin="112,0" VerticalAlignment="Top" Orientation="Horizontal">
                <Button Style="{StaticResource CaptionButtonStyle}" Command="{x:Static FacebookClient:MainHeaderControl.ShowMiniModeCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}">
                  <Path Width="10" Height="10" Data="M64.54,0L98.15,33.60 57.44,74.31 80,96.86 0,96.86 0,16.86 23.84,40.70z" Fill="White" Stretch="Fill" />
                </Button>
              </StackPanel>
            </Grid>

          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style TargetType="{x:Type FacebookClient:FooterControl}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type FacebookClient:FooterControl}">
          <Border Height="32" BorderBrush="{DynamicResource ApplicationBarBorderBrush}" BorderThickness="1,0,1,1">
            <Border.Style>
              <Style TargetType="{x:Type Border}">
                <Setter Property="Background" Value="{DynamicResource FooterBackground}" />
                <Setter Property="CornerRadius" Value="0,0,6,6" />
                <Style.Triggers>
                  <DataTrigger Binding="{Binding Path=WindowState, RelativeSource={RelativeSource AncestorType={x:Type FacebookClient:MainWindow}}}" Value="Maximized">
                    <Setter Property="CornerRadius" Value="0" />
                  </DataTrigger>
                  <DataTrigger Binding="{Binding Path=IsActive, RelativeSource={RelativeSource AncestorType={x:Type FacebookClient:MainWindow}}}" Value="False">
                    <Setter Property="Background" Value="{DynamicResource InactiveFooterBackground}" />
                  </DataTrigger>
                  <DataTrigger Binding="{Binding Source={x:Static ClientManager:ServiceProvider.ViewManager}, Path=IsDialogActive}" Value="True">
                    <Setter Property="Background" Value="{DynamicResource InactiveFooterBackground}" />
                  </DataTrigger>
                </Style.Triggers>
              </Style>
            </Border.Style>
            <Grid>
              <Grid.Style>
                <Style TargetType="{x:Type Grid}">
                  <Setter Property="IsEnabled" Value="True"/>
                  <Style.Triggers>
                    <DataTrigger Binding="{Binding Source={x:Static ClientManager:ServiceProvider.ViewManager}, Path=IsDialogActive}" Value="True">
                      <Setter Property="IsEnabled" Value="False"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=IsOnline}" Value="False">
                      <Setter Property="IsEnabled" Value="False"/>
                    </DataTrigger>
                  </Style.Triggers>
                </Style>
              </Grid.Style>
              <Border Height="6" VerticalAlignment="Top" Background="{DynamicResource ApplicationBarFooterShadowBrush}"/>

              <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,12,0">

                <!-- Inbox -->
                <ToggleButton x:Name="InboxButton" Style="{DynamicResource IconButton}" Tag="{DynamicResource MailGeometry}" Padding="0,5,0,5" Content="Inbox" Margin="12,0,0,0" ToolTipService.Placement="Top" ToolTip="See new messages" IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsInboxToggled, Mode=TwoWay}" />
                <FacebookClient:NotificationCountControl DisplayCount="{Binding Source={x:Static ClientManager:ServiceProvider.ViewManager}, Path=Inbox.Count}">
                  <FacebookClient:NotificationCountControl.Background>
                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                      <GradientStop Color="#4c94d7" Offset="0" />
                      <GradientStop Color="#1876cd" Offset="1" />
                    </LinearGradientBrush>
                  </FacebookClient:NotificationCountControl.Background>
                </FacebookClient:NotificationCountControl>

                <!-- Notifications -->
                <ToggleButton x:Name="NotificationsButton" Style="{DynamicResource IconButton}" Tag="{DynamicResource FlagGeometry}" Padding="0,2,0,2" Content="Notifications" Margin="12,0,0,0" ToolTipService.Placement="Top" ToolTip="See new notifications" IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=AreNotificationsToggled, Mode=TwoWay}" />
                <FacebookClient:NotificationCountControl x:Name="NotificationControl" DisplayCount="{Binding Source={x:Static ClientManager:ServiceProvider.ViewManager}, Path=Notifications.Count}">
                  <FacebookClient:NotificationCountControl.Background>
                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                      <GradientStop Color="#e25423" Offset="0" />
                      <GradientStop Color="#dc2300" Offset="1" />
                    </LinearGradientBrush>
                  </FacebookClient:NotificationCountControl.Background>
                </FacebookClient:NotificationCountControl>

                <!-- Who's Online-->
                <ToggleButton x:Name="ChatButton" Style="{DynamicResource IconButton}" Tag="{DynamicResource PersonGeometry}" Padding="0,2,0,2" Content="Who's Online" Margin="12,0,0,0" ToolTipService.Placement="Top" ToolTip="See who else is around" IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsBuddyListToggled, Mode=TwoWay}" />
                <FacebookClient:NotificationCountControl DisplayCount="{Binding Source={x:Static ClientManager:ServiceProvider.ViewManager}, Path=OnlineFriends.Count}">
                  <FacebookClient:NotificationCountControl.Background>
                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                      <GradientStop Color="#5da110" Offset="0" />
                      <GradientStop Color="#308700" Offset="1" />
                    </LinearGradientBrush>
                  </FacebookClient:NotificationCountControl.Background>
                </FacebookClient:NotificationCountControl>
              </StackPanel>

              <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
                <Button Content="Settings" Tag="{DynamicResource GearGeometry}" Margin="12,0,0,0" Padding="0,3,0,4" Command="{x:Static FacebookClient:FooterControl.ShowSettingsCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Style="{DynamicResource IconButton}" ToolTipService.Placement="Top" ToolTip="View and change settings" />
                <Button Content="Sign Out" Tag="{DynamicResource ExitGeometry}" Margin="8,0,0,0" Padding="0,3,0,3" Command="{x:Static FacebookClient:FooterControl.SignOutCommand}" Style="{DynamicResource IconButton}" ToolTipService.Placement="Top" ToolTip="Sign out" />
                <Button Content="Refresh" Tag="{DynamicResource RefreshGeometry}" Margin="6,0,0,0" Padding="0,3,0,3" Command="{x:Static FacebookClient:FooterControl.RefreshCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Style="{DynamicResource IconButton}" ToolTipService.Placement="Top" ToolTip="Think you're missing something? Click to refresh now." />
              </StackPanel>
            </Grid>
          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
</ClientManagerView:EventResourceDictionary>
